<!DOCTYPE html>
<html>
<head>
<title>qrySofa.html</title>

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<link rel="stylesheet" type="text/css" href="css/pubStyle.css">
<link rel="stylesheet" type="text/css" href="css/test.css">
<style type="text/css">
<!--
body {
	background-color: #F7F7F7;
	margin: 0px;
}
-->
</style>
<script type="text/javascript" src="js/cookie_util.js"></script>
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
<script type="text/javascript" src="js/sofa.js"></script>
<script type="text/javascript">
    var acctId = getCookie("uid");
    var realName = getCookie("realName");
    if (acctId == null) {
        window.location.href = "index.html";
    }
    var qryTag = getCookie("qryTag");
    if(qryTag == 0){
        //window.location.href="homePage.html";
        var address = getCookie("address");
        var sex = getCookie("sex");
        var minAge = getCookie("minAge");
        var maxAge = getCookie("maxAge");
        var pernum = getCookie("pernum");
         $.ajax({
            url:"/SofaGuest/sofa/qrySimpleSofa.do",
            type:"post",
            data:{"address":address,"sex":sex,
                  "minAge":minAge,"maxAge":maxAge,
                  "pernum":pernum},
            dataType:"json",
            success:function(result){
                if("0000" == result.status){
                    //alert(result.detial);
                    var sofaInfos = result.data;
                    dealSofaInfo(sofaInfos);
                }else{
                    alert(result.detial);
                    window.location.href="homePage.html";
                }
            }
        });
        
    }else{
        //查询所有的沙发信息
        getAllSimpleSofaInfo();
    }
    $(function(){
        $("#acctId").html(realName);
        logOut();//退出登录功能
    });
    
    function sofaDetial(a){
        $a = $(a);
        var sofaId = $a.parent().data("sofaId");
        //alert(sofaId);
        addCookie("qrySofaDetialSofaId",sofaId,2);
        window.location.href="sofaDetail.html";
    }
    
</script>

</head>

<body>
	<div class="top">
		<div class="top-page">
			<div id="nav-title">
				<a href="homePage.html" class="title">首页</a>
            	<a href="Javascript:void(0)" class="title" onclick="gotoqrySofaHtml()">找沙发</a>
            	<a href="addSofa.html" class="title">我有沙发</a>
            	<a href="travelList.html" class="title">分享沙旅</a>
            	<a href="personMan.html" class="title">个人管理</a>
			</div>
			<div id="loginfo">
				<span>当前登陆：</span>
				<span id="acctId"></span>
				<span><a href="Javascript:void(0)" id="safeout"  target="_self">安全退出</a></span>
			</div>
		</div>
	</div>
	<div class="main-content">
		<div class="emp-line"></div>
		<div class="qry-page">
			<div class="qrySofaimg" id="res-title">
				<span>&nbsp;&nbsp;查询沙发</span>
			</div>
			<div class="emp-line"></div>
			<div class="qry-info">
				<div class="safa-list">
						<div class="tbmu">
							以下是查找到的用户列表，您还可以<a href="homePage.html">重新查询</a>
						</div>
						 <ul class="buddy" id="sofaInfoLi">
							<!--<li class="bbda">
								<div class="minipic"><img src="img/tim.jpg" width="64px" height="64px"></div><!-- 图 -->
							<!-- 	<h4>沙发类型</h4>
								<h4>创建时间</h4>
								<a href="sofaDetail.html" id="chkdetail">查看详情</a>
							</li>
							<li class="bbda">
								<div class="minipic"><img src="img/timg.jpg" width="64px" height="64px"></div><!-- 图 -->
							<!-- 	<h4>沙发类型</h4>
								<h4>创建时间</h4>
								<a href="Javascript:void(0)" id="chkdetail" onclick="sofaDetial(this)">查看详情</a>
							</li>-->
						</ul> 
				</div>
			</div>
		</div>
	</div>
</body>
</html>
